<template>
  <d2-container better-scroll>
    <div class="app-container">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="策略管理" name="first">
          <v-tactical ref="child1" class="is-active"></v-tactical>
        </el-tab-pane>
        <el-tab-pane label="策略期初盈亏" name="second">
          <v-ProfitAndLoss ref="child2"></v-ProfitAndLoss>
        </el-tab-pane>
      </el-tabs>
    </div>
  </d2-container>
</template>
<script>
import tactical from "./componnets/tactical_management/strategicManagement.vue";
import ProfitAndLoss from "./componnets/tactical_management/strategiceBeginProfitAndLoss.vue";
export default {
  components: {
    "v-tactical": tactical,
    "v-ProfitAndLoss": ProfitAndLoss
  },
  data() {
    return {
      activeName: "first",
      tactical,
      ProfitAndLoss
    };
  },
  methods: {
    updateType() {
      let type = this.$route.query.type;
      // 判断type的值，更改activeName的值
      if (type === "first") {
        this.activeName = "first";
      } else if (type === "second") {
        this.activeName = "second";
      }
    },
    handleClick(tab, event) {
      console.log(tab, event);
    }
  },
  mounted() {
    this.updateType();
  }
};
</script>
